package com.hex.ds.hdrs.warn.service;

import com.hex.ds.hdrs.warn.dao.WarnContentDao;
import com.hex.ds.hdrs.warn.po.WarnContent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Package: com.hex.ds.hdrs.warn.service
 * @ClassName WarnContentService
 * @Description:
 * @Author: ji.tang
 * @Date 2022/4/28 10:38
 * @Version v1.0
 **/
@Slf4j
@Service
public class WarnContentService {

    @Autowired
    private WarnContentDao warnContentDao;

    /**
     * @Method: insert
     * @Param: [warnContent]
     * @Return: void
     * @Description: 新增
     * @Author: ji.tang
     * @Date: 2022/4/28 10:41
     * @Version: V1.0
     */
    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
    public void insert(WarnContent warnContent) {
        this.warnContentDao.insert(warnContent);
    }

    /**
     * @Method: selectById
     * @Param: [pkId]
     * @Return: com.hex.ds.hdrs.warn.po.WarnContent
     * @Description: 条件查询
     * @Author: ji.tang
     * @Date: 2022/4/29 18:09
     * @Version: V1.0
     */
    public WarnContent selectById(String pkId) {
        return this.warnContentDao.selectById(pkId);
    }

    /*
     * @Method: queryByWarnConfId <br>
     * @Param: [confId] <br>
     * @Return: com.hex.ds.hdrs.warn.po.WarnContent <br>
     * @Description：查询指定配置的最新告警记录<br>
     * @Author： wz.li<br>
     * @Date： 2023/1/18 11:10 <br>
     * @Version： V2.0.2<br>
     */
    public WarnContent queryByWarnConfId(String confId) {
        return warnContentDao.queryByWarnConfId(confId);
    }
}
